<template>
  <div id="app">
    <el-button type="primary">{{ $t("message.hello") }} </el-button>
    <el-divider></el-divider>
    <el-select v-model="international" placeholder="切换语言">
      <el-option label="英语" value="en"></el-option>
      <el-option label="中文" value="cn"> </el-option>
    </el-select>
    <el-divider></el-divider>
    <el-button @click="changeLang">切换</el-button>
  </div>
</template>
<script>
export default {
  data() {
    return {
      international: "cn"
    };
  },
  methods: {
    changeLang() {
      this.$confirm("是否切换语言?", "提示", {
        confirmButtonText: this.$t("message.sure"),
        // cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          this.$i18n.locale = this.international;
        })
        .catch(() => {});
    }
  }
};
</script>
<style lang="scss"></style>
